using UnityEngine;

public class PlayerState_正常移动 : PlayerStateBase
{
	public override void OnEnter()
	{
		_Timer = 0.3f;
	}

	public override void OnExit()
	{
	}

	public override void OnUpdate()
	{
		if (_Mono.F_PlayerMove(10f))
		{
			_Mono._Ani.Play("跑步");
		}
		else
		{
			_Mono._Ani.Play("站立");
		}
		if (Input.GetKeyDown(KeyCode.I))
		{
			F_跳跃();
		}
		else if (Input.GetKeyDown(KeyCode.J))
		{
			F_轻攻击();
		}
		else if (Input.GetKeyDown(KeyCode.L))
		{
			F_翻滚();
		}
		else if (Input.GetKeyDown(KeyCode.K))
		{
			F_重攻击Down();
		}
		else if (Input.GetKeyDown(KeyCode.O))
		{
			F_棍花Down();
		}
		else if (Input.GetKeyDown(KeyCode.R))
		{
			F_喝酒();
		}
		else if (Input.GetKeyDown(KeyCode.U))
		{
			F_定身术();
		}
	}

	public override void F_喝酒()
	{
		if (_Mono._Curr酒 > 0)
		{
			_Mono.ChangeState(StateType_Player.喝酒);
		}
	}

	public override void F_棍花Down()
	{
		_Mono.ChangeState(StateType_Player.棍花);
	}

	public override void F_棍花Up()
	{
	}

	public override void F_跳跃()
	{
		_Mono.ChangeState(StateType_Player.跳跃);
	}

	public override void F_轻攻击()
	{
		_Mono.ChangeToState(_Mono._State_攻击连段_判定);
	}

	public override void F_重攻击Down()
	{
		_Mono.ChangeState(StateType_Player.蓄力);
	}

	public override void F_重攻击Up()
	{
	}

	public override void F_翻滚()
	{
		_Mono.ChangeState(StateType_Player.翻滚);
	}

	public override void F_定身术()
	{
		if (!MonoSingleton<MyDataManager>.Instance._PlayerData._教程_定身术教程)
		{
			return;
		}
		if (_Mono._isOk_定身术)
		{
			Collider2D[] array = Physics2D.OverlapBoxAll(_Mono.transform.position, new Vector2(30f, 12f), 0f, LayerMask.GetMask("Enemy"));
			if (array.Length != 0)
			{
				Vector2 a = _Mono.transform.position;
				Collider2D collider2D = array[0];
				float num = Vector2.Distance(a, collider2D.transform.position);
				for (int i = 1; i < array.Length; i++)
				{
					float num2 = Vector2.Distance(a, array[i].transform.position);
					if (num2 < num)
					{
						num = num2;
						collider2D = array[i];
					}
				}
				_Mono._定身目标 = collider2D.GetComponentInParent<I定身术>();
				_Mono.ChangeState(StateType_Player.定身术);
				Debug.LogError(collider2D.name);
			}
			else
			{
				Debug.LogError("范围内无目标");
			}
		}
		else
		{
			Debug.LogError("定身术在冷却");
		}
	}
}
